﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using GaiNo.Core.Extensions;
namespace GaiNo.Core.Helpers
{
    public static class ConfigHelper
    {
        public static string GetString(string key)
        {
            return ConfigurationManager.AppSettings.GetStringOrNull(key);
        }
        public static bool? GetBoolean(string key)
        {
            return ConfigurationManager.AppSettings.GetBooleanOrNull(key);
        }

        public static int? GetInt32(string key)
        {
            return ConfigurationManager.AppSettings.GetIntOrNull(key);
        }

        private static string[] GetStringArray(string key, string separator)
        {
            string value = GetString(key);
            if (!value.IsNullOrEmpty())
                return value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries);

            return null;
        }
    }
}
